<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/frameset.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<STYLE type=text/css>
BODY {
	FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: 宋体
}
TD {
	FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: 宋体
}
.error{
	color: red;
}
.success{
	color: green;
}


</STYLE>

<META content="MSHTML 6.00.6000.16809" name=GENERATOR>
<!--引入jQuery  -->
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.11.3.min.js"></script>

<script type="text/javascript">
	
	//校验登录名
	function checkCode() {
		
		//获取值
		var code = $("#user_code").val();
		if (code.trim() == "") {
			$("#RequiredFieldValidator3").addClass("error")
			$("#RequiredFieldValidator3").html("登录名不能为空")
		}else{
			//发送agax请求
			var url = "${pageContext.request.contextPath }/usercheckCode";
			var param = {"user_code":code};
			$.post(url,param,function(data){
				
				//操作data，进行判断
				if (data && data == "fail") {
					$("#RequiredFieldValidator3").addClass("error");
					$("#RequiredFieldValidator3").html("登录名已经存在");
				}else{
					$("#RequiredFieldValidator3").removeClass("error");
					$("#RequiredFieldValidator3").addClass("success");
					$("#RequiredFieldValidator3").html("可以注册");
				}
				
				
			});
			
		}
		
	}
	//阻止表单提交(false)
	function checkForm() {
		//先让校验名称的方法执行
		checkCode();
		//获取error
		if ($(".error").size()>0) {
			return false;
		}
	}
	
</script>

</HEAD>
<BODY>
<FORM id=form1 name=form1 action = "${pageContext.request.contextPath }/userregist" onsubmit="return checkForm()"  method=post>

<DIV id=UpdatePanel1>
<DIV id=div1 
style="LEFT: 0px; POSITION: absolute; TOP: 0px; BACKGROUND-COLOR: #0066ff"></DIV>
<DIV id=div2 
style="LEFT: 0px; POSITION: absolute; TOP: 0px; BACKGROUND-COLOR: #0066ff"></DIV>


<DIV>&nbsp;&nbsp; </DIV>
<DIV>
<TABLE cellSpacing=0 cellPadding=0 width=900 align=center border=0>
  <TBODY>
  <TR>
    <TD style="HEIGHT: 105px"><IMG src="images/login_1.gif" 
  border=0></TD></TR>
  <TR>
    <TD background=images/login_2.jpg height=300>
      <TABLE height=300 cellPadding=0 width=900 border=0>
        <TBODY>
        <TR>
          <TD colSpan=2 height=35></TD></TR>
        <TR>
          <TD width=360></TD>
          <TD>
            <TABLE cellSpacing=0 cellPadding=2 border=0>
              <TBODY>
              <TR>
                <TD style="HEIGHT: 28px" width=80>登 录 名：</TD>
                <TD style="HEIGHT: 28px" width=150><INPUT id="user_code" 
                  style="WIDTH: 130px" name="user_code" onblur="checkCode()"></TD>
                <TD style="HEIGHT: 28px" width=370><SPAN 
                  id=RequiredFieldValidator3 
                  style="FONT-WEIGHT: bold; "></SPAN></TD></TR>
              <TR>
                <TD style="HEIGHT: 28px">登录密码：</TD>
                <TD style="HEIGHT: 28px"><INPUT id="user_password" style="WIDTH: 130px" 
                  type=password name="user_password"></TD>
                <TD style="HEIGHT: 28px"><SPAN id=RequiredFieldValidator4 
                  style="FONT-WEIGHT: bold; "></SPAN></TD></TR>

				 <TR>
                <TD style="HEIGHT: 28px">用户名：</TD>
                <TD style="HEIGHT: 28px"><INPUT id="user_name" style="WIDTH: 130px" 
                  type=text name="user_name"></TD>
                <TD style="HEIGHT: 28px"><SPAN id=RequiredFieldValidator4 
                  style="FONT-WEIGHT: bold; "></SPAN></TD></TR>
				
              <TR>
                <TD style="HEIGHT: 18px"></TD>
                <TD style="HEIGHT: 18px"></TD>
                <TD style="HEIGHT: 18px"></TD></TR>
              <TR>
                <TD></TD>
                <TD>
            
                  <input type="submit" value="注册">
                  
              </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD><IMG src="images/login_3.jpg" 
border=0></TD></TR></TBODY></TABLE></DIV></DIV>


</FORM></BODY></HTML>


</body>
</html>